<?php
	session_start();
	require_once 'photo.php';
	if (isset($_GET['fotobaru']))
	{
		$hasil=photo::NewestPhoto();
		$i = mysql_num_rows($hasil);
		while ($i-->0)
		{
			$baris = mysql_fetch_row($hasil);
			echo '<div class="thumbListPhoto" onclick="document.location=\'detail.php?id='.$baris[2].'\'">';
			echo '<div class="thumbfloater">';
			$string = 'users/'.$baris[2].'/'.$baris[0];
			echo '<img class="thumbnail" src="'.$string.'" />';
			echo '</div></div>';
		}
	}
	else if (isset($_GET['fotopopuler']))
	{
		$hasil2=photo::PopularPhoto();
		$i = mysql_num_rows($hasil2);
		while ($i-->0)
		{
			$baris = mysql_fetch_row($hasil2);
			$path=photo::GetPath($baris[0], $baris[1]);
			echo '<div class="thumbListPhoto" onclick="document.location=\'detail.php?id='.$baris[1].'\'">';
			echo '<div class="thumbfloater">';
			$string = 'users/'.$baris[1].'/'.$path;
			echo '<img class="thumbnail" src="'.$string.'" />';
			echo '</div></div>';
		}
	}
	else
		echo "Kosong";
?>